//
//  WatchCircleCollectionViewCell.m
//  CarPark
//
//  Created by oceans on 2019/7/19.
//  Copyright © 2019 oceans. All rights reserved.
//

#import "WatchCircleCollectionViewCell.h"

@implementation WatchCircleCollectionViewCell

- (void)clear {
    
    _start = 0;
    for (CALayer *layer in _backView.layer.sublayers) {
        [layer removeFromSuperlayer];
    }
}

- (void)stroke:(CGFloat)radius color:(UIColor *)color {
    
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height*0.5) radius:(self.bounds.size.height-20)*0.5 startAngle:_start endAngle:_start+radius clockwise:YES];
    CAShapeLayer *layer = [CAShapeLayer layer];
    layer.fillColor = [UIColor clearColor].CGColor;
    layer.path = path.CGPath;
    layer.lineWidth = 20.0;
    layer.strokeColor = color.CGColor;
    layer.strokeEnd = 1.0;
    [self.backView.layer addSublayer:layer];
    _start += radius;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

@end
